package com.ty.xiaoyu.config;

import com.ty.xiaoyu.interceptor.JWTInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptor())
                // 获取搜索记录
                .addPathPatterns("/homePage/getSearchHistoryList")
                // 删除搜索记录
                .addPathPatterns("/homePage/deleteSearchHistoryList")
                // 删除浏览记录
                .addPathPatterns("/common/deleteHistoryById")
                // 发布帖子
                .addPathPatterns("/common/releaseTopic")
                // 回复帖子
                .addPathPatterns("/common/releaseReply")
                // 发布评论
                .addPathPatterns("/common/releaseComment")
                // 点赞
                .addPathPatterns("/common/great")
                // 获取最近浏览的模块
                .addPathPatterns("/module/getBrowsingHistoryListOfModule")
                // 修改用户信息
                .addPathPatterns("/user/modifyInformation")
                // 获取用户浏览记录列表
                .addPathPatterns("/user/getBrowsingHistoryList")
                // 注销
                .addPathPatterns("/user/logout")
                // 获取我的点赞
                .addPathPatterns("/user/getMyGreat")
                // 获取我的发布的帖子
                .addPathPatterns("/user/getMyTopic")
                // 通知系统
                .addPathPatterns("/notify/**");

                // 登陆请求
//                .excludePathPatterns("/user/login")
                // 注册请求
//                .excludePathPatterns("/user/register");
    }
}
